1. Field of the Invention
The present invention relates to an encoding apparatus and an encoding method.
2. Description of the Related Art
With the recent rapid development in digitization of information relating to the so-called multimedia such as audio signals and image signals, compression encoding/decoding techniques for image signals are gathering attention. The compression encoding/decoding techniques can reduce the storage capacity required for storage of image signals and the bandwidth required for transmission of image signals.
With a commonly used compression encoding/decoding technique, the information amount (data amount) is compressed by using a high degree of auto-correlation (i.e., redundancy) that many image signals have. The redundancy of an image signal includes time redundancy and two-dimensional space redundancy. Time redundancy can be reduced by using motion detection and motion compensation in units of blocks. On the other hand, space redundancy can be reduced by using discrete cosine transform (DCT).
The most efficient of the encoding methods using this technique that are currently used is H.264/MPEG-4 PART 10 (AVC) (hereinafter, referred to as “H.264”). However, there is currently an increasing need for an encoding method that provides an even higher compression ratio in order to, for example, compress a Super High Vision (SHV) image having a resolution 16 times that of a high vision image, or exchange an image having an even higher resolution in a limited transmission band. For this reason, studies have been conducted on improvements in encoding efficiency by Joint Collaboration Team-Video Coding (JCTVC), which is a joint standardization organization of ITU-T and ISO/IEC. As a result, an encoding method called High Efficiency Video Coding (HEVC) has been officially authorized by ITU-T in January, 2013.
HEVC is expected to have compression efficiency twice that of H.264. To achieve this compression efficiency, HEVC adopts various new techniques. Among them is an adaptive loop filter called Sample Adaptive Offset (SAO). The basic method of SAO is described in Japanese Patent Laid-Open No. 2012-005113. A more description of SAO in HEVC will be given below.
SAO is a technique intended to improve the image quality by determining whether a pixel to which a deblocking filter has been applied corresponds to conditions set in SAO, and adding an appropriate offset value to the pixel, thereby making the encoded image more similar to the original image. Two types of modes are defined as the SAO modes. In either mode, pixels are classified into five categories, and an offset value is set for each category. The process of adding or not adding an offset value is executed for each Coding Tree Unit (CTU).
Band Offset mode (hereinafter, referred to as “BO”), which is one of the SAO modes, will be described with reference to FIG. 3. In BO, pixel values from a minimum value (0 in FIG. 3) to a maximum value (255 in FIG. 3) are divided equally into 32 bands. For each pixel, an offset process is executed while switching the offset value according to the band to which the pixel belongs.
In BO, an offset value is added to pixels belonging to four consecutive bands of the 32 bands. In a CTU on which BO is executed, sao_band_position (a pixel value of 32 in FIG. 3), which indicates a band to which an offset is applied, is specified, and the four consecutive bands (a pixel value of 32 to a pixel value of 63 in FIG. 3) therefrom are specified as the four categories for which the offset is on. On the other hand, the other bands are categories for which the offset is off. Since BO modifies pixels having a value within a specific range, it is the mode in which modification effectively works particularly if the dispersion in the pixel values included in a CTU is small.
Next, Edge Offset mode (hereinafter, referred to as “EO”), which is the other SAO mode, will be described with reference to FIG. 4. In HO, pixels are classified into categories based on the magnitude relationship between the pixel value of a pixel within the CTU and the pixel values of neighboring pixels, as shown on the lower side of FIG. 4. As shown on the upper side of FIG. 4, four patterns are defined as the positions of the neighboring pixels used for comparison of the magnitude relationship. The encoding apparatus determines which of the four patterns is to be used. EO has the effect of modifying local peaks and valleys of pixel values such that they are smoothed. Thus, EO is the mode that works effectively to modify mosquito noise occurring near steep edges in the original image.
SAO can improve the image quality by making a decoded image similar to the original image by setting an appropriate offset value during encoding. However, if SAO fails to set the offset value appropriately, it may degrade the image quality on the contrary.
Japanese Patent Laid-Open No. 2012-005113 proposes, as the method for determining the offset value, a method that uses the difference between an average value of pixel values before encoding and an average value of pixel values after encoding (after local decoding). This method enables modification of average pixel values, and thus improves Peak signal-to-noise ratio (PSNR), thereby improving a basic image quality. Depending on the state of the pixel values after encoding, however, the method may not be able to sufficiently improve the image quality. With reference to FIGS. 5A and 5B, a description will be given of a case where the image quality cannot be improved sufficiently.
FIG. 5A shows pixel values of a CTU to be encoded and pixel values of a local decoded CTU after encoding and before execution of SAO process if the CTU size is 4×4, for example. In the example shown here, BO is applied as the SAO mode. Similar to FIG. 3, sao_band_position is set to start from a pixel value of 32, and all pixel values of the local decoded CTU belong to the Val1 category. In FIG. 5A, the difference between an average value of the pixel values before encoding and an average value of the pixel values after encoding is calculated to be a value of 2. Thus, in accordance with Japanese Patent Laid-Open No. 2012-005113, the offset value is 2.
FIG. 5B is a graphical representation in which a difference value between each pixel of the CTU after SAO process and the corresponding pixel of the CTU to be encoded if the offset value is set to 2 and a difference value between each pixel of the CTU before SAO process and the corresponding pixel of the CTU to be encoded are plotted in the raster order from the top left for comparison. In FIG. 5B, the closer the difference value approaches 0, the smaller the difference from the CTU to be encoded. Thus, it is shown that the image quality is improved. As can be seen from the difference values after SAO process, the addition of the offset value causes the difference value of many pixels, except for some pixels, to approach 0, indicating that the image quality is somewhat improved. However, most pixels still have a difference value of 3, and the difference in pixel value from the CTU to be encoded has not been eliminated yet.